<?php

require '../claroline/inc/claro_init_global.inc.php';
require_once get_path('incRepositorySys').'/lib/user.lib.php';

// Fonctions javascript
$htmlHeadXtra[] = '<script type="text/javascript" src="PORTFOL/lib/jquery.js"></script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="PORTFOL/lib/portfolio.js"></script>';
$htmlHeadXtra[] ='<script type="text/javascript" src="C2IPRAT/lib/pratique.js"></script>';
$htmlHeadXtra[] ='<script type="text/javascript" src="lib/portfolioNumerique.js"></script>';

$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="C2IPRAT/css/pratique.css" />';
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="PORTFOL/css/portfolio.css" />';
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="lib/portfolioNumerique.css" />';

if ($_REQUEST['partie'] == "Aide")
$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="../../puzzle/pieces/puzzle.css" />';

if (!get_init('is_authenticated') ) claro_disp_auth_form(true);

include_once('lib/conf.php');
include_once('lib/portfolioNumerique.lib.php');

// Classes pour la gestion des documents
include_once('lib/classes/document.class.php');
include_once('lib/classes/documentCompetence.class.php');


if ($_REQUEST['edition'] || $_REQUEST['cmd'])
{
	include_once('PORTFOL/entry.php');
	exit;
}

// Propriétaire du portfolio
$proprietaire = claro_get_current_user_id();
if ($_SESSION['accesPortfolioEtudiant'] && ($_REQUEST['proprietaire']))
{
	//$dialogBox .= '<form action="'.$_SERVER['PHP_SELF'].'?partie=tout&action=chercher" method="POST">Acc&eacute;der au portfolio de l\'&eacute;tudiant num&eacute;ro : <input type="text" name="proprietaire" value="'.$_REQUEST['proprietaire'].'"><input type="submit"></form>';

	if (isset($_REQUEST['proprietaire']))
	{
		$proprietaireTmp = chercheUserIdPFL($_REQUEST['proprietaire']);

		if (!$proprietaireTmp)
		$dialogBox .= '<p><strong>Etudiant inconnu</strong></p>';
		else
		{
			$proprietaire = $proprietaireTmp;
			$urlProprietaire = "&proprietaire=".$_REQUEST['proprietaire'];
		}
	}
}


$user_infos = user_get_properties($proprietaire);


// Pas de header si on y accède par la fiche d'évaluation
if ($_GET['proprietaire'])
$hide_banner = true;


include get_path('incRepositorySys').'/claro_init_header.inc.php';


// Autoévaluation
if ($_GET['autoeval'] == true)
{
	$_REQUEST['modele_id'] = $portfolioId;
	include_once('PORTFOL/evaluation.php');
	exit;
}




echo "<h1>Portfolio des comp&eacute;tences num&eacute;riques</h1>
Portfolio de ".$user_infos['firstname']." ".$user_infos['lastname'];

/*
if (in_array(claro_get_current_user_id(),$utilisateurs) && !$_GET['proprietaire'])
echo "<br><a href=\"".$_SERVER['PHP_SELF']."?action=chercher\">Acc&eacute;der &agrave; un autre portfolio</a>";
*/

$idPartie[$_REQUEST['partie']] = 'id="portfolioCurrent"';

echo '<div id="portfolioMenu"><ul>';

if (in_array("Exp",$partiesVisibles))
echo "<li ".$idPartie['Exp']."><a href=\"".$_SERVER['PHP_SELF']."?partie=Exp".$urlProprietaire."\">Mes exp&eacute;riences num&eacute;riques</a></li>";

if (in_array("N1",$partiesVisibles))
echo "<li ".$idPartie['N1']."><a href=\"".$_SERVER['PHP_SELF']."?partie=N1".$urlProprietaire."\">Mon C2i niveau 1</a></li>";

if (in_array("N2MD",$partiesVisibles))
echo "<li ".$idPartie['N2MD']."><a href=\"".$_SERVER['PHP_SELF']."?partie=N2MD".$urlProprietaire."\">Mon C2i N2 M&eacute;tiers du droit</a></li>";

if (in_array("N2MS",$partiesVisibles))
echo "<li ".$idPartie['N2MS']."><a href=\"".$_SERVER['PHP_SELF']."?partie=N2MS".$urlProprietaire."\">Mon C2i N2 M&eacute;tiers de la sant&eacute;</a></li>";

if (in_array("N2MEAD",$partiesVisibles))
echo "<li ".$idPartie['N2MEAD']."><a href=\"".$_SERVER['PHP_SELF']."?partie=N2MEAD".$urlProprietaire."\">Mon C2i N2 M&eacute;tiers de l'EAD</a></li>";

if (in_array("Aide",$partiesVisibles))
echo "<li ".$idPartie['Aide']."><a href=\"".$_SERVER['PHP_SELF']."?partie=Aide".$urlProprietaire."\">Comment remplir son portfolio ?</a></li>";

/*
if (count($partiesVisibles) == 3)
echo "<li ".$idPartie['tout']."><a href=\"".$_SERVER['PHP_SELF']."?partie=tout".$urlProprietaire."\">Tout afficher</a></li>";
*/

echo '</ul></div>' . "\n";


if ($dialogBox && !$_GET['proprietaire'])
{
	echo claro_html_message_box($dialogBox);
}


// Partie expériences numériques
if ($_REQUEST['partie'] == 'Exp' || $_REQUEST['partie'] == 'tout')
{
	$_REQUEST['modele_id'] = $portfolioId;
	include_once('PORTFOL/evaluation.php');
}

if ($_REQUEST['partie'] == 'N1' || $_REQUEST['partie'] == 'tout')
{
	// Partie C2i N1
	$C2i = 'N1';

	if (!$idPartie[$C2i])
	echo "<h3>C2i niveau 1</h3>";

	include_once('theorique.php');

	include_once('pratique.php');

	//echo '<iframe src="pratique.php?proprietaire='.$proprietaire.'-1" style="width:90%;height:400px"></iframe>';
}

if ($_REQUEST['partie'] == 'N2MD' || $_REQUEST['partie'] == 'tout')
{
	// Partie C2i N2
	$C2i = 'N2MD';

	if (!$idPartie['N2MD'])
	echo "<h3>C2i niveau 2</h3>";

	//include('theorique.php');

	include('pratique.php');
}

if ($_REQUEST['partie'] == 'N2MS' || $_REQUEST['partie'] == 'tout')
{
	// Partie C2i N2
	$C2i = 'N2MS';

	if (!$idPartie['N2MS'])
	echo "<h3>C2i niveau 2</h3>";

	
	//include('theorique.php');

	include('pratique.php');
}

if ($_REQUEST['partie'] == 'N2MEAD' || $_REQUEST['partie'] == 'tout')
{
	// Partie C2i N2
	$C2i = 'N2MEAD';

	if (!$idPartie['N2MEAD'])
	echo "<h3>C2i niveau 2</h3>";

	
	//include('theorique.php');

	include('pratique.php');
}

// Aide remplir son portfolio
if ($_REQUEST['partie'] == 'Aide')
{
	include('aide.php');
}




include get_path('incRepositorySys').'/claro_init_footer.inc.php';

?>
